using sly.parser;
using sly.parser.generator;
using sly.lexer;
using System.Collections.Generic;
using System;

public enum ExpressionToken {
    [Lexeme("[0-9]+")] 
    INT = 1,

    [Lexeme("\\+")] 
    PLUS = 2
}

public class ExpressionParser {
    [Production("expresion: INT")]
    public int intExpr(Token<ExpressionToken> intToken)
    {
        return intToken.IntValue;
    }

    [Production("expression : term PLUS expression")]
    public int Expression(int left, Token<ExpressionToken> operatorToken, int right) {
        return left + right;
    }

    [Production("term : INT")]
    public int Expression(Token<ExpressionToken> intToken) {
        return intToken.IntValue;
    }
}